home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / plot02 < prev    next >
Text File  |  1997-07-08  |  1KB  |  56 lines

  1. ; This batch file creates a PostScript file of the plot created in
  2. ; Chapter 10, "Plotting", of _Using IDL_.
  3.  
  4. ; First, store the current graphics device.
  5.  
  6. old_dev=!D.NAME
  7.  
  8. ; Set the current graphics device to PostScript.
  9.  
  10. SET_PLOT, 'PS'
  11.  
  12. ; Use hardware fonts.
  13.  
  14. !P.FONT=0
  15.  
  16. ; Specify a filename for the PostScript file we will create. The
  17. ; file will be placed IDL's current working directory when this
  18. ; batch file is run. Select the Times Roman PostScript font.
  19.  
  20. DEVICE, FILE='plot.ps', /TIMES
  21.  
  22. ; Run a batch file to define the variables used to create the plot.
  23.  
  24. @plot01
  25.  
  26. ; Store the index of the last point in the variable N1.
  27.  
  28. N1 = N_ELEMENTS(YEAR) - 1
  29.  
  30. ; Plot first graph. Set the y-axis min and max from the min and max of 
  31. ; all data sets. The default linestyle is 0.
  32.  
  33. PLOT, YEAR, COHO, YRANGE = [MIN(ALLPTS), MAX(ALLPTS)], $
  34.     TITLE='Salmon Populations', XTITLE = 'Year', YTITLE = 'Fish (thousands)', $
  35.     XRANGE = [1965, 1990], /XSTYLE    
  36.  
  37. ; Loop for the three remaining scores, varying the linestyle. 
  38.  
  39. FOR I = 1, 3 DO OPLOT, YEAR, ALLPTS(*, I), LINESTYLE = I
  40.  
  41. ; Append the title of each graph on the right. 
  42.  
  43. FOR I = 0, 3 DO XYOUTS, 1984, ALLPTS(N1, I), NAMES(I)
  44.  
  45. ; Close the PostScript file.
  46.  
  47. DEVICE, /CLOSE
  48.  
  49. ; Use vector fonts.
  50.  
  51. !P.FONT=1
  52.  
  53. ; Set the current graphics device back to its original setting.
  54.  
  55. SET_PLOT, old_dev
  56.